set pathSql="%programfiles%\Microsoft SQL Server\90\Tools\Binn\sqlCmd.exe"
set dbServer=".\DH2"
set dbUser=sa
set dbPassword="123"
set db="Biblioteca"
set err=0

@echo off
for /f "tokens=2-4 delims=/ " %%i in ("%date%") do (
    set mm=%%i
    set dd=%%j
    set yy=%%k
    )
set today=%yy%%mm%%dd%

for /f "tokens=1-4 delims=:. " %%i in ("%time%") do ( 
    set hh=%%i
    set mm=%%j
    )
set now=%hh%%mm%
set logFile="Result%today%%now%.txt"
set log=..\%logFile%

echo ---------------------------------------------------------------- >> %logFile%
echo Execution sur %dbServer%, %db% >> %logFile%
echo ---------------------------------------------------------------- >> %logFile%

for /D %%d IN (*) DO (
	cd "%%d"

	echo ---------------------------------------------------------------- >> %log%
	echo Execution du fichier "%%d\ParseFichierSQL.bat" >> %log%
	echo ---------------------------------------------------------------- >> %log%
	call "ParseFichierSQL.bat" 

	cd ..
)

%logFile%
pause

exit %err% 
